home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: cs.utexas.edu!utnut!utinfo!news
- From: Dave Goldstein <dave.goldstein@utoronto.ca>
- Subject: Help!
- X-Nntp-Posting-Host: jingle.dialin.utoronto.ca
- Content-Type: text/plain; charset=us-ascii
- Message-ID: <31420B3D.75A0@utoronto.ca>
- Sender: news@utcc.utoronto.ca (News)
- Content-Transfer-Encoding: 7bit
- Organization: UTCC Campus Access
- Mime-Version: 1.0
- Date: Sat, 9 Mar 1996 22:50:37 GMT
- X-Mailer: Mozilla 2.0 (Win95; I)
-
- I'm working on a program that reads in string after string of input and
- parses each string looking for valid integer numbers. I need to retain
- all these #'s to do some calculations when when it hits eof, but my
- problem is that there is *no* maximum amount of numbers. Therefore I
- can't just say:
- #MAX_NUM 100
- int values[MAX_NUM]
-
- which is what I'm used to doing. So I need to use dynamic memory
- allocation, but how do I allocate a certain amount of memory if I don't
- even have any idea of how many integers there are going to be in the
- input??? Sounds like vertigo to me. I can't use a command line
- argument, nor can I just allocate a huge amount of space for the
- program.
-
- From what I also understand, once something is malloc'ed, it becomes
- fixed in size. Sorry if I'm rambling, but if you have an idea please
- write me by mail at:
-
- dave.goldstein@utoronto.ca
-
- Thanks in advance!
-